package com.javafx.simple.demo;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.io.IOException;
import java.util.Objects;

/**
 * JavaFX应用
 */
public class LoginApplication extends Application {

    @Override
    public void start(Stage stage) throws IOException {

        System.out.println("进入登录界面");

        FXMLLoader fxmlLoader = new FXMLLoader(LoginApplication.class.getResource("login.fxml"));
        Scene scene = new Scene(fxmlLoader.load(), 320, 240);

        // 设置窗口图标
        Image icon = new Image(Objects.requireNonNull(LoginApplication.class.getResourceAsStream("/images/app.png")));
        stage.getIcons().add(icon);

        stage.setTitle("登录");
        stage.setScene(scene);
        stage.show();
    }
}
